<?php
// +----------------------------  用户收藏表  ------------------------------------------
declare(strict_types=1);

namespace app\model;

use think\Model; 

class UserCollections extends Model
{
    protected $autoWriteTimestamp = 'datetime';

    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    protected $type = [
        'id'            => 'integer',
        'user_id'       => 'string',
        'goods_id' => 'string',
        'create_time'   => 'datetime',
        'update_time'   => 'datetime',
        'status'        => 'boolean', // 收藏状态，1表示已收藏，0表示未收藏
    ];

    // 关联商品模型
    public function goods()
    {
        return $this->belongsTo(Goods::class, 'goods_id', 'goods_id');
    }
}
